<script type="text/javascript" src="http://<?php echo $doctor['consult_url']?>/cgi-bin/pubinfo.cgi"></script>
<script type="text/javascript" src="http://<?php echo $doctor['consult_url']?>/plugindef.js"></script>

<script>
    $(function(){
        var timeout3 = 4000;//Save Time Interval
        var timer3;

        $(document).ready(function() {
            timer3 = $.timer(timeout3, function() {
                loadChat();
            });
        });

        $("#chat_submit").button();

        function loadChat(){
            $.ajax({
                type: "POST",
                url: "../ajax/loadChat",
                data: {
                    p_id:$("input#p_id").val(),
                    c_id:$("input#c_id").val()
                },
                dataType: "html",
                success: function(data) {
                    $("#chat_div").html(data);
                }
            });
        }

        $("#frmChat").submit(function(){           
            $.ajax({
                type: "POST",
                url: "../ajax/sendChat",
                data: {
                    p_id:$("input#p_id").val(),
                    c_id:$("input#c_id").val(),
                    chat_txt:$("input#chat_txt").val(),
                    from:$("input#from").val()
                },
                dataType: "html",
                success: function(data) {
                    $("#chat_div").html($("#chat_div").html()+"<br>กำลังส่งข้อความ");
                    $("input#chat_txt").val("");
                }
            });
            return false;
        });
    });
</script>


<SCRIPT language=JavaScript>
    <!--
    if ((navigator.appName == "Microsoft Internet Explorer")&&(navigator.platform != "MacPPC"))
    {
        document.write("<OBJECT ID=\"VAtCtrl\" WIDTH=280 HEIGHT=253 name=\"VAtCtrl\"");
        document.write(" CLASSID=CLSID:210D0CBC-8B17-48D1-B294-1A338DD2EB3A");
        document.write(" CODEBASE=\"/VatDec.cab#version=1,0,0,68\">");
        document.write("<PARAM NAME=\"VSize\" VALUE=\"SIF\">");
        document.write("<PARAM NAME=\"Language\" VALUE=\"en\">");
        document.write("<PARAM NAME=\"Deblocking\" VALUE=\"true\">");
        document.write("<PARAM NAME=\"DisplayTimeFormat\" VALUE=\"1\">");
        document.write("<PARAM NAME=\"DigitalZoomEnableChk\" VALUE=\"true\">");
        document.write("<PARAM NAME=\"DigitalZoomEdit\" VALUE=\"true\">");
        document.write("<PARAM NAME=\"Url\" VALUE=\"http://<?php echo $url?>/cgi-bin/control.cgi\">");
        document.write("<PARAM NAME=\"UserName\" VALUE=\"<?php echo $username?>\">");
        document.write("<PARAM NAME=\"Password\" VALUE=\"<?php echo $password?>\">");
        document.write("</OBJECT>");
    }
    //-->
</SCRIPT>
<br><br>
<table width="280" style="border: 1px solid gray;font-size: 14px;background-color: white" cellspacing="0" cellpadding="3">
    <thead><tr class="ui-widget-header"><td colspan="5">ข้อมูลคุณหมอ</td></tr></thead>
    <tbody align="left">
        <tr><td rowspan="4">
            <div id="display_image">
                <script type="text/javascript">
                    <!--
                    // The ActiveX plug-in
                    document.write("<object id=\"" + PLUGIN_ID + "\" width=120 height=120");
                    document.write(" standby=\"Loading plug-in...\" classid=CLSID:" + CLASS_ID);
                    document.write(" codebase=\"/" + PLUGIN_NAME + "#version=" + PLUGIN_VER + "\">");
                    document.write("<param name=\"Url\" VALUE=\"rtsp://<?php echo $doctor['consult_url']?>/" + RTSPAccessName +"\">");
                    document.write("<param name=\"Stretch\" VALUE=\"" + STRETCH + "\">");
                    document.write("<param name=\"VSize\" VALUE=\"CMS\">");
                    document.write("<param name=\"Language\" VALUE=\"" + PLUGIN_LANG + "\">");
                    document.write("<param name=\"ClientOptions\" VALUE=\"567\">");
                    document.write("This is a plug-in (ActiveX). If you see this text, your browser is not support or disable ActiveX.");
                    document.write("<\/object>");
                    //-->
                </script>
            </div>
            </td>
            <td style="font-weight: bold"><?php echo isset($doctor['consult_doctor_name'])?$doctor['consult_doctor_name']:"" ?></td>
        </tr>
<tr><td style="font-weight: bold"><?php echo isset($doctor['consult_doctor_hospital'])?$doctor['consult_doctor_hospital']:""?></td></tr>
<tr></tr>                
<tr><td style="font-weight: bold"><?php echo isset($doctor['consult_tel'])?$doctor['consult_tel']:"" ?></td></tr>
<tr><td style="font-weight: bold"><?php echo isset($doctor['consult_email'])?$doctor['consult_email']:"" ?></td></tr>
</tbody>
</table>
<br>
<form action="" id="frmChat">
    <table width="280" style="border: 1px solid gray;font-size: 14px;background-color: white" cellspacing="0" cellpadding="3">
        <tr class="ui-widget-header"><td colspan="3">Chat</td></tr>
        <tr><td colspan="2" align="center">
                <div id="chat_div" style="width: 270px;height: 70px;overflow: auto;background-color: #eeeeee" align="left">

                </div></td></tr>
        <tr><td align="right"><input type="text" id="chat_txt" name="chat_txt" size="30"></td>
            <td><input id="chat_submit" type="submit" value="ส่ง"></td>
        </tr>
    </table>
    <input type="hidden" id="p_id" name="p_id" value="<?php echo $p_id?>">
    <input type="hidden" id="c_id" name="c_id" value="<?php echo $c_id?>">
    <input type="hidden" id="from" name="from" value="P">
</form>
